<!-- 注意import 导入包语句，在JSP中的多种使用方法 -->
<%@page import="com.dhcc.countlineusers.entity.OnlineUser" %>
<%@page import="java.util.List" %>
<%@page language="java"  import="java.util.ArrayList"  contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<table width=100%; height= 100; align="center" border="1" >
    <tr bgcolor="#6699CC">
        <th colspan="3" align="center">
            1.当前在线人数为：${userCountNum }<br>
            2.当前在线人数为<%= request.getServletContext().getAttribute("userCountNum")  %>
        </th>
    </tr>
    <tr bgcolor="#FF9966">
        <th align="center">SessionID</th>
        <th align="center">登录IP地址</th>
        <th align="center">登录时间</th>
    </tr>
        <% 
        List<OnlineUser> onlineUserList = (ArrayList<OnlineUser>)request.getServletContext().getAttribute("onlineUserList");
        if(null !=onlineUserList && !onlineUserList.isEmpty()){
            int i = 0;
            String color = "#CCCCFF";
            for(OnlineUser user : onlineUserList){
                if(i%2==0){
                    color = "#CCCCFF";
                }else{
                    color = "#FFFFFF";
                }
        %>
            <tr bgcolor="<%=color %>">
	            <td  align="center"><%=user.getSessionIdStr() %></td>
	            <td align="center"><%=user.getIpStr() %></td>
	            <td align="center"><%=user.getLoginTimeStr() %></td>
            </tr>
        <%
            i++;
            }
        }
        %>
</table>
</body>
</html>